<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="css/WdatePicker.css" rel="stylesheet" type="text/css" />
<link href="css/select.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
<script type="text/javascript" src="js/select-ui.min.js"></script>
<script type="text/javascript" src="js/WdatePicker.js"></script>

    <script type="text/javascript">
        $(document).ready(function(e) {
            $(".select1").uedSelect({
                width : 345
            });
            $(".select2").uedSelect({
                width : 167
            });
            $(".select3").uedSelect({
                width : 100
            });
        });
    </script>

</head>

<body>
	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="#">首页</a></li>
    <li><a href="#">表单</a></li>
    </ul>
    </div>

    <div class="formbody">

    <div class="formtitle"><span>客户信息</span></div>

    <ul class="forminfo">

    <li><label>客户</label><input name="cus_name" id="cus_name" type="text" class="dfinput" /><i></i></li>
    <li><label>联系人</label><input name="cus_linkman" id="cus_linkman" type="text" class="dfinput" /><i></i></li>
    <li><label>性别</label><cite><input name="cus_sex"  type="radio" value="0" checked="checked" />男&nbsp;&nbsp;&nbsp;&nbsp;<input name="cus_sex" type="radio" value="1" />女</cite></li>
    <li><label>地区</label>
    <div class="vocation">
        <select class="select2" name='cus_area' id="cus_area">
            <option value='普通会员'>华中地区</option>
            <option>交互设计师</option>
            <option>前端设计师</option>
        </select>
    </div>
    </li>
    <li><label>省市</label>
           <div class="vocation"> <select class="select3" id="s_province" name="s_province"></select> </div> 
            <div class="vocation"><select class="select3" id="s_city" name="s_city" ></select> </div> 
            <div class="vocation"><select class="select3" id="s_county" name="s_county"></select></div>
            <script class="resources library" src="js/area.js" type="text/javascript"></script>

            <script type="text/javascript">_init_area();</script>

        <div id="show"></div>
    </li>
        <li><label>等级</label>
    <div class="vocation">
    <select class="select2" name='cus_level' id="cus_level">
    <option value='普通会员'>普通会员</option>
    <option>交互设计师</option>
    <option>前端设计师</option>
    </select>
    </div>
    </li>
    <li><label>生日</label><input name="cus_birthday" id="cus_birthday" type="text" class="dfinput" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})"/></li>
    <li><label>地址</label><input name="cus_address" id="cus_address" type="text" class="dfinput" /><i>多个关键字用,隔开</i></li>
    <li><label>手机</label><input name="cus_phone" id="cus_phone" type="text" class="dfinput" />
    <li><label>身份证号</label><input name="cus_identity_num" id="cus_identity_num" type="text" class="dfinput" />
    <li><label>入会地点</label>
        <div class="vocation">
            <select class="select2" name='cus_join_address' id="cus_join_address">
                <option value='普通会员'>深圳</option>
                <option>交互设计师</option>
                <option>前端设计师</option>
            </select>
        </div>
    </li>
    <li><label>卡号</label><input name="cus_card_number" id="cus_card_number" type="text" class="dfinput" />
    <li><label>&nbsp;</label><input name="" type="button" id='btn' class="btn" value="添加"/></li>
    </ul>
    </div>


</body>
<script type="text/javascript" src="js/WdatePicker.js"></script>
</html>
<script>

$(function(){
    $('#btn').bind('click',function(){
       var cusData = new Array('cus_name','cus_linkman','cus_level');
        var len = cusData.length;
        for(var i=0;i<len;i++){

            var data = new Array();
            data[cusData[i]] = $("#"+cusData[i]).val();
        }

        /*cus_name = $("input[name=cus_name]").val();
        cus_linkman = $("input[name=cus_linkman]").val();
        cus_sex = $("input[name=cus_sex]").val();
        cus_level = $("select[name=cus_level]").val();*/
        $.ajax({
            type:"post",
            data:{"infos":data},
            url:"../api/customer.php?action=add",
            success:function(result){
                alert(result);
               if(result == 1){
                   window.location.href = "./right.html";
               }else{
                   alert('添加失败');
               }
            },
            error:function(){
                alert("提交错误");
            }
        });
    });

})
</script>
<!--省市联动js-->
<script type="text/javascript">
    var Gid  = document.getElementById ;
    var showArea = function(){
        Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +
        Gid('s_city').value + " - 县/区" +
        Gid('s_county').value + "</h3>"
    }
    Gid('s_county').setAttribute('onchange','showArea()');
</script>